package com.feeyin.radar.crm.controller.ajax;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.springframework.web.servlet.view.AbstractView;

public class AjaxView extends AbstractView {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel
	 * (java.util.Map, javax.servlet.http.HttpServletRequest,
	 * javax.servlet.http.HttpServletResponse)
	 */

	@Override
	protected void renderMergedOutputModel(Map map, HttpServletRequest request,HttpServletResponse response) throws Exception {
		JSONObject json = JSONObject.fromObject(map);
		response.setContentType("text/plain; charset=UTF-8");   
		response.getOutputStream().write(json.toString().getBytes());
		response.setHeader("Cache-Control",   "no-cache,   must-revalidate");   
	}

}
